import java.util.Random;
import java.util.Scanner;

public class GuessNumber {
    int suijishuzi;


    public GuessNumber() {
        Random a = new Random();
        suijishuzi = a.nextInt(100);
    }


    public void start() {
        Scanner scr = new Scanner(System.in);
        for (int times = 0; times < 7; times++) {
            System.out.println("只有七次机会哦，输入你猜的0～100数字");
            int guess = scr.nextInt();
            if(guess < suijishuzi) {
                System.out.println("猜的有点小了呢");
            }else if(guess>suijishuzi) {
                System.out.println("猜的有点大了呢");
            }else {
                System.out.println("恭喜你猜对啦！要不要再玩一次呀？");
                return;
            }
        }System.out.println("机会已经用完啦，要不要再玩一次呢？");
    }


    public static void main(String[] args) {
        while(true) {
            System.out.println("输入1. 咱就开始游戏 ");
            System.out.println("输入2. 咱就退出游戏 ");
            int choose ;
            Scanner scr = new Scanner(System.in);
            choose = scr.nextInt();
            switch(choose) {
                case 1: new GuessNumber().start(); break;
                case 2: System.out.println("已成功退出游戏！"); return;
                default: break;
            }
        }
    }
}